<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <%@include file="head.jsp" %>
    <title>授权提醒</title>

</head>
<body>
<input id="openid" class="weui-input" type="hidden" value="${info.openid}">
<input id="unionid" class="weui-input" type="hidden" value="${info.unionid}">
<input id="nickname" class="weui-input" type="hidden" value="${info.nickname}">
<input id="appName" class="weui-input" type="hidden" value="${appName}">
<input id="clientid" class="weui-input" type="hidden" value="${clientid}">
<div class="weui-msg">
    <div class="weui-msg__icon-area"><i class="weui-icon-success weui-icon_msg"></i></div>
    <div class="weui-msg__text-area">
        <h3 class="weui-msg__title">您是否授权打开应用?</h3>

    </div>
    <div class="weui-msg__opr-area">
        <p class="weui-btn-area">
            <input type="button" onclick="auth()" id="but_login" value="授权" class="weui-btn weui-btn_primary">
        </p>
    </div>
    <div class="weui-msg__extra-area">
        <div class="weui-footer">
            <p class="weui-footer__text">Copyright © 2020 </p>
        </div>
    </div>
</div>

</body>
<%@include file="footer.jsp" %>
<script>
    $(document).ready(function () {
        // var vConsole = new VConsole();
        // console.log('VConsole is cool');
    });

    function auth() {

        var jsonData = JSON.stringify({
            nickname: $("#nickname").val(),
            openid: $("#openid").val(),
            unionid: $("#unionid").val(),
            appName: $("#appName").val(),
            clientid: $("#clientid").val()
        });
        $.ajax({
            url: '/auth/getAuthorization',
            type: 'post',
            dataType: 'json',
            data: jsonData,
            contentType: "application/json",
            async: false,
            timeout: 50000,
            success: function (data) {
                console.log(data);
                $.alert(data.message);
            },
            error: function (msg) {
                console.log(msg);
                $.alert(msg);
            }
        });
    }
</script>
</html>